package com.example.administrator.orchardeveryday.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.orchardeveryday.R;
import com.example.administrator.orchardeveryday.bean.SubLevel;
import com.example.administrator.orchardeveryday.utils.ImageLoaderHelper;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 15-10-21.
 */
public class KindFragmentContentAdapter extends AppBaseAdapter<SubLevel>{
    DisplayImageOptions displayImage;
    public KindFragmentContentAdapter(List<SubLevel> list, Context context) {
        super(list, context);
        displayImage = ImageLoaderHelper.getDisplayImageLoader();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        SubLevel subLevel=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_kind_fragment_gridview);
        ImageView iv= (ImageView) vh.findViewById(R.id.item_kind_fragment_content_img);
        TextView tv= (TextView) vh.findViewById(R.id.item_kind_fragment_content_tv);
        ImageLoader.getInstance().displayImage(list.get(position).getClass_photo(), iv, displayImage);
        tv.setText(subLevel.getName());
        return vh;
    }
}
